// CGWorkView.h : interface of the CCGWorkView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_CGWORKVIEW_H__5857316D_EA60_11D5_9FD5_00D0B718E2CD__INCLUDED_)
#define AFX_CGWORKVIEW_H__5857316D_EA60_11D5_9FD5_00D0B718E2CD__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#include "gl\gl.h"    // Include the standard CGWork  headers
#include "gl\glu.h"   // Add the utility library

#include "Coordinates.h"
#include "Light.h"
#include "Plotter.h"
#include "BackgroundImage.h"
#include "Drawer.h"
class CCGWorkView : public CView
{
protected: // create from serialization only
	CCGWorkView();
	DECLARE_DYNCREATE(CCGWorkView)

	// Attributes
public:
	CCGWorkDoc* GetDocument();

	// Operations
public:

private:
	int m_nAxis;						// Axis of Action, X Y or Z
	int m_nAction;						// Rotate, Translate, Scale
	int m_nView;						// Orthographic, perspective
	bool m_bIsPerspective;				// is the view perspective
	bool m_bIsBoundingBox;				// is the bounding Box activated
	bool m_bIsVertexNormals;			// is the vertex normals activated
	bool m_bIsPolygonNormals;			// is the polygon normals activated
	bool m_bIsClickToLight;			    // is the click to light activated
	bool m_renderOnScreen;				// Do we render on screen or no
	bool m_imageBackground;				// Do we render on screen or no
	bool m_backface_culling;
	bool m_transparency;
	bool inAnimation;
	int lastRenderOnScreen;

	int fineness;
	int rotateSensitivity;
	int translateSensitivity;
	int scaleSensitivity;
	std::vector<HW2::Drawer> drawers;



	HW2::BackgroundImage backgroundImage;
	HW2::Coordinates mouseDown; // Position of the last left button down
		
	CString m_strItdFileName;		// file name of IRIT data

	int m_nLightShading;			// shading: Flat, Gouraud.

	double m_lMaterialAmbient;		// The Ambient in the scene
	double m_lMaterialDiffuse;		// The Diffuse in the scene
	double m_lMaterialSpecular;		// The Specular in the scene
	int m_nMaterialCosineFactor;		// The cosine factor for the specular

	LightParams m_lights[MAX_LIGHT];	//configurable lights array
	LightParams m_ambientLight;		//ambient light (only RGB is used)


	// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCGWorkView)
public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	//}}AFX_VIRTUAL

	// Implementation
public:
	virtual ~CCGWorkView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	BOOL InitializeCGWork();
	BOOL SetupViewingFrustum(void);
	BOOL SetupViewingOrthoConstAspect(void);
	void renderOnScreen(CDC* pDC);
	void render(HW2::Plotter &p, int height, int width);
	virtual void RenderScene();


	HGLRC    m_hRC;			// holds the Rendering Context
	CDC*     m_pDC;			// holds the Device Context
	int m_WindowWidth;		// hold the windows width
	int m_WindowHeight;		// hold the windows height

	double m_AspectRatio;		// hold the fixed Aspect Ration

	// Generated message map functions
protected:
	//{{AFX_MSG(CCGWorkView)
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnDestroy();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnFileLoad();
	afx_msg void OnViewOrthographic();
	afx_msg void OnUpdateViewOrthographic(CCmdUI* pCmdUI);
	afx_msg void OnViewPerspective();
	afx_msg void OnUpdateViewPerspective(CCmdUI* pCmdUI);
	afx_msg void OnActionRotate();
	afx_msg void OnUpdateActionRotate(CCmdUI* pCmdUI);
	afx_msg void OnActionScale();
	afx_msg void OnUpdateActionScale(CCmdUI* pCmdUI);
	afx_msg void OnActionTranslate();
	afx_msg void OnUpdateActionTranslate(CCmdUI* pCmdUI);
	afx_msg void OnAxisX();
	afx_msg void OnUpdateAxisX(CCmdUI* pCmdUI);
	afx_msg void OnAxisY();
	afx_msg void OnUpdateAxisY(CCmdUI* pCmdUI);
	afx_msg void OnAxisZ();
	afx_msg void OnAxisXY();
	afx_msg void OnUpdateAxisZ(CCmdUI* pCmdUI);
	afx_msg void OnLightShadingFlat();
	afx_msg void OnUpdateLightShadingFlat(CCmdUI* pCmdUI);
	afx_msg void OnLightShadingGouraud();
	afx_msg void OnUpdateLightShadingGouraud(CCmdUI* pCmdUI);
	afx_msg void OnLightConstants();
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnUpdateBoundingBox();
	afx_msg void OnUpdateVertexNormals();
	afx_msg void OnUpdatePolygonsNormals();
	afx_msg void OnIncreasePerspectiveD10();
	afx_msg void OnDecreasePerspectiveD10();
	afx_msg void OnChangeColorBackground();
	afx_msg void OnChangeColorNormals();
	afx_msg void OnChangeColorVertex();
	afx_msg void OnMouseSensitivity();
	afx_msg void OnFinenessControl();
	afx_msg void OnViewSpace();
	afx_msg void OnObjectSpace();
	afx_msg void OnSetCTL();
	afx_msg void OnUnSetCTL();
	afx_msg void OnRenderOnScreen();
	afx_msg void OnRenderOnFile();
	afx_msg void onLightMaterialParams();
	afx_msg void OnLightShadingPhong();
	afx_msg void OnUpdateLightShadingPhong(CCmdUI* pCmdUI);
	afx_msg void OnSetImageBackground();
	afx_msg void onUpdatMaterialvars();
	afx_msg void onUpdatTextureWood();
	afx_msg void onUpdatTextureMarbel();
	afx_msg void onUpdatTextureRust();
	afx_msg void onUpdatTextureArmy();
	afx_msg void onUpdatTextureEarth();
	afx_msg void onUpdateTextureReptileSkin();
	afx_msg void onUpdateTextureCustom();
	afx_msg void onAddBase();
	afx_msg void addShadows();
	


	afx_msg void onActivateFog();
	afx_msg void onSetFogColor();
	//afx_msg void OnLightShadingPhong();


	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnNormalInverse();
	afx_msg void OnOptionsSwitchbackfaceculling();
	afx_msg void OnTransparencyEnable();
	afx_msg void OnTransparencyDisable();
	afx_msg void OnAntialiasingNone();
	afx_msg void OnAntialiasingBox();
	afx_msg void OnAntialiasingGauss();
	afx_msg void OnAntialiasingTriangle();
	afx_msg void OnAntialiasingSinc();
	afx_msg void OnAntialiasingFiltersize3x3();
	afx_msg void OnAntialiasingFilterSize5x5();
};

#ifndef _DEBUG  // debug version in CGWorkView.cpp
inline CCGWorkDoc* CCGWorkView::GetDocument()
{ return (CCGWorkDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CGWORKVIEW_H__5857316D_EA60_11D5_9FD5_00D0B718E2CD__INCLUDED_)
